﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Shop.Intermediate;
using Shop.Intermediate.Data;
using Shop.Core;
using DoNet.Common.Utilities;


namespace Shop.WebApp.SysBase
{
    public partial class DepartmentManage : BasePage
    {
        private static readonly DepartmentCore m_departmentCore = new DepartmentCore();
        private int m_pageCount, m_recordCount;
        private const int PAGE_SIZE = 3;
        private Shop.WebApp.UserControl.SplitPage<IBasicType> spControl;
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    spControl = new Shop.WebApp.UserControl.SplitPage<IBasicType>();
                    pnPage.Controls.Add(spControl);

                    if (!Page.IsPostBack)
                    {
                        gvList.DataSource = m_departmentCore.PageResultQuery<IBasicType>(null, null
                            , null, null, 1, PAGE_SIZE, out m_pageCount, out m_recordCount);
                        gvList.DataBind();

                        spControl.Condition = null;
                        spControl.ConditionValue = null;
                        spControl.Orderby = null;
                        spControl.OrderbyValue = null;
                        spControl.PageCount = m_pageCount;
                        spControl.PageSize = PAGE_SIZE;
                        spControl.RecordCount = m_recordCount;
                        spControl.CurrentPageNo = 1;
                        spControl.Container = "gvList";
                        spControl.PageSplit = m_departmentCore;
                    }
                }
                catch (Exception ex)
                {
                    ProcessUnhandledException(ex);
                }
            }
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {

        }

        protected void btnSave_Click(object sender, EventArgs e)
        {

        }

        protected void btnUpadate_Click(object sender, EventArgs e)
        {

        }
    }
}
